package com.zsw.customer2c.service.impl;


import com.zsw.customer2c.service.testServiceProducer2;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;


@Component
public class TestServiceProducer2FallbackFactory implements FallbackFactory<testServiceProducer2> {

    private String message = "当前调用的服务端是ServiceProducer2，该服务端异常";
    @Override
    public testServiceProducer2 create(Throwable throwable) {
        System.out.println("熔断：FallbackFactory,暂停服务" + ":" + throwable);
        return new testServiceProducer2() {


            @Override
            public String test() {
                return "FallbackFactory: service is not available,method:test"+message;
            }

            @Override
            public String hi(String id) {
                return message+" ,FallbackFactory: service is not available,method:hi:" + id;
            }

            @Override
            public String expectFallback() {
                return message +" FallbackFactory: service is not available,method:expectFallback";
            }
        };

    }
}
